package net.microfigure.service.impl;

import net.microfigure.model.ZcPolicy;
import net.microfigure.commons.result.PageInfo;
import net.microfigure.mapper.ZcPolicyMapper;
import net.microfigure.service.IZcPolicyService;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 慢性病政策表 服务实现类
 * </p>
 *
 * @author 林景锋
 * @since 2018-06-15
 */
@Service
public class ZcPolicyServiceImpl extends ServiceImpl<ZcPolicyMapper, ZcPolicy> implements IZcPolicyService {

	
	@Autowired
	private ZcPolicyMapper zcPolicyMapper;
	
	@Override
	public void selectDataGrid(PageInfo pageInfo) {
		// TODO Auto-generated method stub
	
		Page<ZcPolicy> page = new Page<ZcPolicy>(pageInfo.getNowpage(), pageInfo.getSize());
		EntityWrapper<ZcPolicy> wrapper = new EntityWrapper<ZcPolicy>();
		wrapper.orderBy(pageInfo.getSort(),pageInfo.getOrder().equalsIgnoreCase("ASC"));
		selectPage(page,wrapper);
		pageInfo.setRows(page.getRecords());
		pageInfo.setTotal(page.getTotal());
		
	}
	public List<ZcPolicy> selectAll(){
		
		EntityWrapper<ZcPolicy> wrapper = new EntityWrapper<ZcPolicy>();
		wrapper.orderBy("seq");
		return zcPolicyMapper.selectList(wrapper);
		
		
		
	}
	@Override
	public ZcPolicy selectRunyearEqualCurrentYear(int currentYear) {
		// TODO Auto-generated method stub
		return zcPolicyMapper.selectRunyearEqualCurrentYear(currentYear);
	}
	
}
